read a file in java and store as integer array using buffered reader

83

read a file in java and store as integer array using buffered reader -

String[] integersInString = br.readLine().split(" ");
int a[] = new int[integersInString.length];
for (int i = 0; i < integersInString.length; i++) {
    a[i] = Integer.parseInt(integersInString[i]);
}

Comments

Submit
0 Comments